package cn.myschool.test;

import cn.myschool.entity.ExamResult;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.InputStream;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ExamTest2 {
    public static void main(String[] args) throws IOException {
        InputStream in = Resources.getResourceAsStream("mybatis-config.xml");
        SqlSessionFactory build = new SqlSessionFactoryBuilder().build(in);
        //SQLsession ==Connection
        SqlSession sqlSession = build.openSession();
        List<ExamResult> objects = sqlSession.selectList("cn.myschool.dao.ExamDao.findALL");
        objects.forEach(System.out::println);

        sqlSession.close();
    }
}
